PATH_TO_SYSTEM_CORE:=$(REPO_TOP)/platform_system_core
PATH_TO_EXTERNAL_ZLIB:=$(REPO_TOP)/platform_external_zlib

LOCAL_SRCS_LIBSPARSE:=$(PATH_TO_SYSTEM_CORE)/libsparse/backed_block.c
LOCAL_SRCS_LIBSPARSE+=$(PATH_TO_SYSTEM_CORE)/libsparse/output_file.c
LOCAL_SRCS_LIBSPARSE+=$(PATH_TO_SYSTEM_CORE)/libsparse/sparse.c
LOCAL_SRCS_LIBSPARSE+=$(PATH_TO_SYSTEM_CORE)/libsparse/sparse_crc32.c
LOCAL_SRCS_LIBSPARSE+=$(PATH_TO_SYSTEM_CORE)/libsparse/sparse_err.c
LOCAL_SRCS_LIBSPARSE+=$(PATH_TO_SYSTEM_CORE)/libsparse/sparse_read.c
LOCAL_SRCS_ZLIB:=$(PATH_TO_EXTERNAL_ZLIB)/*.c
LOCAL_MAIN:=$(PATH_TO_SYSTEM_CORE)/libsparse/simg2img.c

LOCAL_FLAG_INC:=-I$(PATH_TO_SYSTEM_CORE)/libsparse/include/
LOCAL_FLAG_INC+=-I$(PATH_TO_EXTERNAL_ZLIB)

download:
	echo "Nothing TODO"
checkout:
	cd $(PATH_TO_SYSTEM_CORE) && git checkout android-7.1.2_r39
build:
	gcc -c $(LOCAL_MAIN) $(LOCAL_SRCS_LIBSPARSE) $(LOCAL_FLAG_INC) $(CFLAGS)
	gcc -c $(LOCAL_SRCS_ZLIB) $(LOCAL_FLAG_INC) $(CFLAGS)
	gcc -o $(BIN_PATH) ./*.o $(CFLAGS)

clean:
	echo "TODO"
